package com.example.GenericParadigm.test;


import com.example.GenericParadigm.Appclass;
import com.example.GenericParadigm.Bppclass;
import com.example.GenericParadigm.GInterface;
import org.testng.annotations.Test;

public class GInterfacetest  {

    /**GInterface  接口泛型进行限定 只允许T 继承了Appclass 类
     * 这样的情况需要处理的就是我们针对APPclass的子类进行限定性的特殊处理
     */

    @Test
    public  void  TestGInterface() throws IllegalAccessException, InstantiationException {
        GInterface<Bppclass> GInterface= new GInterface<Bppclass>() {

            @Override
            public Bppclass gettype() {
                return new Bppclass();
            }
        };

        Bppclass gettype = GInterface.gettype();
        gettype.printtest();

        Class class1 = gettype.getClass1(String.class);
        Class class2 = gettype.getClass2(Integer.class);
        Class class3 = gettype.getClass3(Appclass.class);
        Class class4 = gettype.getClass4(Number.class);
        Number o = (Number)class4.newInstance();
    }


}
